const express = require('express');
const http = require('http');
const { Server } = require('socket.io');

const app = express();
const server = http.createServer(app);
const io = new Server(server, { cors: { origin: '*' } });

io.on('connection', (socket) => {
  socket.on('signal', (data) => {
    // 广播信令数据给其他所有客户端
    socket.broadcast.emit('signal', data);
  });
});

server.listen(3001, () => {
  console.log('Signaling server running on port 3001');
}); 